//
//  StringAndArrayViewController.swift
//  test_swift
//
//  Created by fangyuan ding on 2021/6/1.
//

import UIKit

class StringAndArrayViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        let str = "I am FlyElephant"
        let array = str.components(separatedBy:" ")
        print("字符串转数组:\(array)")
        
        let data = [1, 2, 3, 4, 5]
        let dataStr = data.map(String.init)
        let result = dataStr.joined(separator: ",")
        print("数组转字符串:\(result)")
    }
    

 

}
